package com.hjj.homieMatching.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

@Configuration
public class CookieConfig {

    @Bean
    public CookieSerializer cookieSerializer() {
        DefaultCookieSerializer serializer = new DefaultCookieSerializer();
        serializer.setCookieName("HOMIESESSION");
        serializer.setCookiePath("/");
        // 设置域名为frp服务器地址
        serializer.setDomainName("47.109.146.201");
        serializer.setUseHttpOnlyCookie(true);
        serializer.setUseSecureCookie(false);  // 设置为false，允许非HTTPS
        serializer.setSameSite("Lax");  // 确保使用Lax，适用于frpc代理
        return serializer;
    }
} 